#include <iostream>
using std::cout;
using std::endl;
//this指针：就是一个指针，指向的是当前对象
class Point{
public:
    Point(int x, int y)
    :_x(x)
    ,_y(y)
    {

    }

    //成员函数
    void print(){
        cout << _x << "," << _y << endl;
    }
    //经过编译器处理过后
    void print(Point * const this){
        cout << this->_x << "," << this->_y << endl;
    }

    void display(){
        cout << _x * 3 << endl;
    }


private:
    int _x;
    int _y;
};
void test(){
    //对于成员函数的调用有几种形式？？？？
    //1.借助于对象
    Point pt(1, 2);
    pt.print(); ===============>  print(&pt);
    pt.display(); =============>  display(&pt);
    //2.借助于指针
    Point * p = new Point(0, 0);
    p->print(); ===============> print(p);
    p->display();==============> display(p);
    delete p;
    p = nullptr;
}

int main()
{
    test();
    return 0;
}

